﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace SweetSQL.Data
{
    /// <summary>
    /// Class for specifying a column in Sql translation, properties only!
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
    public sealed class ColumnAttribute : Attribute
    {
        /// <summary>
        /// Determines if column is a primary key
        /// </summary>
        public bool IsPrimaryKey
        {
            get;
            set;
        }

        /// <summary>
        /// Determines if column is a foreign key that maps to a primary key of a parent table
        /// </summary>
        public bool IsForeignKey
        {
            get;
            set;
        }

        /// <summary>
        /// Name of mapped property
        /// </summary>
        public string MemberName
        {
            get;
            set;
        }

        /// <summary>
        /// Name of column
        /// </summary>
        public string ColumnName
        {
            get;
            set;
        }

        /// <summary>
        /// Tells if the column can be null, right now only CreateTable() uses this, defaults to false
        /// </summary>
        public bool CanBeNull
        {
            get;
            set;
        }

        /// <summary>
        /// Size of column
        /// </summary>
        public int Size
        {
            get;
            set;
        }

        /// <summary>
        /// Precision of column
        /// </summary>
        public int Precision
        {
            get;
            set;
        }

        /// <summary>
        /// Column data type string, used for CreateTable()
        /// </summary>
        public string DataType
        {
            get;
            set;
        }
    }
}
